class K8s {
    def call(Map config = [:]) {
        return """
apiVersion: v1
kind: Pod
metadata:
  labels:
    jenkins: slave
spec:
  hostAliases:
  - ip: "192.168.56.101"
    hostnames:
    - "harbor.jdicity.local"
  securityContext:
    runAsUser: 0
  containers:
  - name: mvn
    image: ${config.mavenImage ?: 'harbor.jdicity.local/registry/maven:3.8.6-jdk-8'}
    imagePullPolicy: IfNotPresent
    command: ["cat"]
    tty: true
    env:
    - name: TZ
      value: Asia/Shanghai
    - name: LANG
      value: en_US.UTF-8
    - name: LC_ALL
      value: en_US.UTF-8
    volumeMounts:
    - name: jenkins-home
      mountPath: /root/.m2
    - name: time
      mountPath: /etc/localtime
      readOnly: true
  - name: docker
    image: ${config.mavenImage ?: 'harbor.jdicity.local/registry/docker:19.03'}
    imagePullPolicy: IfNotPresent
    command: ["cat"]
    tty: true
    env:
    - name: TZ
      value: Asia/Shanghai
    - name: LANG
      value: en_US.UTF-8
    - name: LC_ALL
      value: en_US.UTF-8
    volumeMounts:
    - name: dockersocket
      mountPath: /run/docker.sock
    - name: docker-config
      mountPath: /etc/docker/daemon.json
  - name: npm
    image: ${config.nodejsImage ?: 'harbor.jdicity.local/registry/nodejs:v18'}
    imagePullPolicy: IfNotPresent
    command: ["cat"]
    tty: true
    env:
    - name: TZ
      value: Asia/Shanghai
    - name: LANG
      value: en_US.UTF-8
    - name: LC_ALL
      value: en_US.UTF-8
  - name: kubectl
    image: ${config.kubectlImage ?: 'harbor.jdicity.local/registry/kubectl:1.28.2'}
    imagePullPolicy: IfNotPresent
    tty: true
    command: ["sleep"]
    args: ["infinity"]
    env:
    - name: TZ
      value: Asia/Shanghai
    - name: LANG
      value: en_US.UTF-8
    - name: LC_ALL
      value: en_US.UTF-8
  - name: helm
    image: ${config.helmImage ?: 'harbor.jdicity.local/registry/helm_jq:latest'}
    imagePullPolicy: IfNotPresent
    command: ["sleep"]
    args: ["infinity"]
    tty: true
    env:
    - name: TZ
      value: Asia/Shanghai
    - name: LANG
      value: en_US.UTF-8
    - name: LC_ALL
      value: en_US.UTF-8
    volumeMounts:
    - name: harborcrt
      mountPath: /usr/local/harbor.jdicity.local.crt
    - name: harborcacrt
      mountPath: /usr/local/harbor.jdicity.local.key
  volumes:
  - name: jenkins-home
    persistentVolumeClaim:
      claimName: jenkins-home-pvc
  - name: dockersocket
    hostPath:
      path: /run/docker.sock
  - name: docker-config
    hostPath:
      path: /etc/docker/daemon.json
      type: File
  - name: time
    hostPath:
      path: /usr/share/zoneinfo/Asia/Shanghai
      type: File
  - name: harborcrt
    hostPath:
      path: /export/server/harbor/certs/harbor.jdicity.local.crt
      type: File
  - name: harborcacrt
    hostPath:
      path: /export/server/harbor/certs/harbor.jdicity.local.key
      type: File
"""
    }
}